<!doctype html>
<html lang="zn">
<head>
<meta charset="utf-8">
<title>管理员添加处理页面</title>
</head>

<body>
<?php    
  require_once("../../conn/conn_db.php");  
  if($_POST["txt_password"]!= "" && $_POST["txt_username"]!= "")
  {
   $name  = $_POST["txt_username"];   //用户名
   $password = $_POST["txt_password"];  //密码
   $tel = $_POST["txt_tel"];            //联系电话
   $email = $_POST["txt_email"];        //Email

   $sql = "insert into admin_info (a_name,a_pwd,a_tel,a_email) values('$name','$password','$tel','$email')";
   // echo $sql; //本语句用于调试，输出查询语句
    $result = $conn->query($sql);  //执行SQL语句
   if(  $result == TRUE )          //判断执行结果
   {
	 echo "<script>alert('管理员添加成功！'); window.location='../admin_manager.php';</script>";
   }
   else
   {
	 echo "<script>alert('管理员添加失败，请重试！'); window.location='../admin_add.php';</script>";
   }	
 }
 else
 {
   echo "<script>alert('请完善管理员信息！'); window.location='../admin_add.php';</script>";
 }
 ?>
</body>
</html>